{template 'store/diypage/_common'}

<form action="" method="post" class="form-horizontal form-validate" role="form">
    <input type="hidden" name="type" value="pageset" />
    <div class="tab-pane">
        <div class="form-group form-horizontal">
            <label class="col-lg control-label">选择页面</label>
            <div class="col-sm-9 col-xs-12">
                <select class="form-control select2" {ifp 'store.diypage.setting'}name="diypage" {else}disabled{/if}>
                    {loop $templist $tempitem}
                    <option value="temp_{$tempitem['id']}" {if $item['diypage_ispage']==0&&$item['diypage']==$tempitem['id']}selected{/if}>[系统模板] {$tempitem['name']}</option>
                    {/loop}
                    {loop $pagelist $pageitem}
                    <option value="page_{$pageitem['id']}" {if $item['diypage_ispage']==1&&$item['diypage']==$pageitem['id']}selected{/if}>[自定义页面] {$pageitem['name']}</option>
                    {/loop}
                </select>
                <div class="help-block">为此门店设置首页模板，可选择系统模板或自定义页面</div>
            </div>
        </div>

        {ifp 'store.diypage.setting'}
            <div class="form-group form-horizontal">
                <label class="col-lg control-label"></label>
                <div class="col-sm-9 col-xs-12">
                    <input type="submit" value="保存设置" class="btn btn-primary"/>
                </div>
            </div>
        {/if}
    </div>
</form>

<!--
<form action="" method="post" class="form-horizontal form-validate" role="form">
    <div class="panel panel-default">
        <div class="panel-heading">门店可用模板</div>
        <div class="panel-body">
            {if empty($templist)}
                <div class="empty-data">暂时没有可用模板，<a href="{php echo webUrl('store/diypage/add')}">立即创建模板</a></div>
            {else}
                <table class="table">
                    <thead>
                        <th style="width: 50px;">ID</th>
                        <th>模板名称</th>
                        <th style="width: 100px; text-align: center;">是否可用</th>
                        <th style="width: 160px;">操作</th>
                    </thead>
                </table>
                <div class="col-12 max500">
                    <table class="table">
                        <thead class="zero">
                        <th style="width: 50px;"></th>
                        <th></th>
                        <th style="width: 100px;"></th>
                        <th style="width: 160px;"></th>
                        </thead>
                        <tbody>
                        {loop $templist $tempitem}
                            <tr>
                                <td>{$tempitem['id']}</td>
                                <td>{$tempitem['name']}</td>
                                <td style="text-align: center;">
                                    {if empty($tempitem['uniacid'])}
                                    默认可用
                                    {else}
                                        <input class="js-switch small" name="templist[]" value="{$tempitem['id']}" type="checkbox" {if $tempitem['selected']==1}checked{/if} />
                                    {/if}
                                </td>
                                <td>
                                    {if empty($tempitem['uniacid'])}
                                    默认模板不可操作
                                    {else}
                                    <a href="{php echo webUrl('store/diypage/edit', array('id'=>$tempitem['id']))}" class="btn btn-default btn-sm"><i class="fa fa-edit"></i> 编辑</a>
                                    <a href="{php echo webUrl('store/diypage/page/add', array('templateid'=>$tempitem['id']))}" class="btn btn-default btn-sm"><i class="fa fa-plus"></i> 创建页面</a>
                                    {/if}
                                </td>
                            </tr>
                        {/loop}
                        </tbody>
                    </table>
                </div>
            {/if}
        </div>
        {if !empty($templist)}
            <div class="panel-footer">
                <input type="submit" value="保存设置" class="btn btn-primary"/>
            </div>
        {/if}
    </div>
</form>
-->

{template '_footer'}